#ifndef SNACK_PLAYMANAGER_H
#define SNACK_PLAYMANAGER_H

#include "Track.h"

// The interface to the play manager, the thing that does 
// most of the stuff we want:
//  - create tracks
//  - cue and/or queue tracks
//  - mix tracks together
//  - queue events.
// Client/UI code should make calls on this thing (and Tracks)
// (and not know anything else).

namespace SnackBreak
{

class MixEvent
{
// later... client just can keep a ref for now.
};

class PlayManager
{
public:
	// Return a ref to the playmanager (there's only one of em).
	static PlayManager& Get();
	
	// Create a track which can be played etc.
	// (The PlayManager owns the pointer - it will free it.)
	virtual Track* CreateTrack(std::string f, CuePair q) = 0;
	virtual Track* CreateTrack(std::string f, CuePair q, double lastBeatNum) = 0;

	// Drop track incoming at the end of track outgoing.
	virtual MixEvent* CreateMix(Track* outgoing, Track* incoming) = 0;

	// Overlap - drop track incoming numBeats before the end of track outgoing.
	virtual MixEvent* CreateMix(Track* outgoing, Track* incoming, double numBeatsToOverlap) = 0;

	// Early Overlap - drop track incoming numBeats after the start of track outgoing.
	virtual MixEvent* CreateEarlyMix(Track* outgoing, Track* incoming, double numBeatsFromStart) = 0;

	// Blend - overlap with linear crossfade. 
	// Can also specify how many beats the crossfade should take
	// and what beat to start incoming track from.
	virtual MixEvent* CreateBlend(Track* outgoing, Track* incoming, double numBeatsToOverlap, double faderBlendBeats = 16.0, double incomingStartBeat = 0.0) = 0;

	// Early Blend - as above.
	virtual MixEvent* CreateEarlyBlend(Track* outgoing, Track* incoming, double numBeatsFromStart, double faderBlendBeats = 16.0, double incomingStartBeat = 0.0) = 0;
};

}; // namespace SnackBreak

#endif SNACK_PLAYMANAGER_H

